﻿namespace ContactsSync.Providers.ViewModels
{
    using Infrastructure.Events;
    using Infrastructure.Models;
    using Microsoft.Practices.Composite.Events;
    using Microsoft.Practices.Composite.Presentation.Commands;

    public class ProviderViewModel : BaseProviderViewModel
    {
        public ProviderViewModel(IEventAggregator eventAggregator)
            : base(eventAggregator)
        {
            this.AddContactCommand = new DelegateCommand<Contact>(this.AddContact);
        }

        public DelegateCommand<Contact> AddContactCommand { get; private set; }

        private void AddContact(Contact contact)
        {
            this.EventAggregator.GetEvent<AddContactEvent>().Publish(contact);
        }
    }
}